/*!
 * Galleria Kooboo Theme
 *
 * Copyright (c) 2010, HOWARD
 */

(function($) {

Galleria.addTheme({
    name: 'kooboo',
    author: 'HOWARD',
    version: '1.0',
    css: 'galleria.kooboo.css',
    defaults: {
        show_caption: false,
		show_counter: false,
        show_imagenav: false,
		show_info: false,
		thumb_fit: false,
        transition: 'flash'
    },
    init: function(options) {
        
        this.$('thumbnails').children().hover(function() {
            $(this).not('.active').children().stop().fadeTo(100, 1);
        }, function() {
            $(this).not('.active').children().stop().fadeTo(400, .4);
        }).not('.active').children().css('opacity',.4);
        
        this.$('container').hover(this.proxy(function() {
            this.$('image-nav-left,image-nav-right,counter').fadeIn(200);
        }), this.proxy(function() {
            this.$('image-nav-left,image-nav-right,counter').fadeOut(500);
        }));
        
        this.$('image-nav-left,image-nav-right,counter').hide();
        
        var elms = this.$('info-link,info-close,info-text').click(function() {
            elms.toggle();
        });
        
        if (options.show_caption) {
            elms.trigger('click');
        }

        this.bind(Galleria.LOADFINISH, function(e) {
            this.$('loader').fadeOut(200);
        });
        this.bind(Galleria.LOADSTART, function(e) {
            $(e.thumbTarget).css('opacity',1).parent().addClass('active')
                .siblings('.active').removeClass('active').children().css('opacity',.4);
        })
    }
});

})(jQuery);